package com.xintai.approval.service.impl;

import java.util.Date;
import java.util.List;
import com.xintai.common.utils.DateUtils;
import com.xintai.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xintai.approval.mapper.FlowBasicinfoMapper;
import com.xintai.approval.domain.FlowBasicinfo;
import com.xintai.approval.service.IFlowBasicinfoService;

/**
 * 定义流程的基本信息Service业务层处理
 *
 * @author xintai
 * @date 2021-02-01
 */
@Service
public class FlowBasicinfoServiceImpl implements IFlowBasicinfoService
{
    @Autowired
    private FlowBasicinfoMapper flowBasicinfoMapper;

    /**
     * 查询定义流程的基本信息
     *
     * @param id 定义流程的基本信息ID
     * @return 定义流程的基本信息
     */
    @Override
    public FlowBasicinfo selectFlowBasicinfoById(Long id)
    {
        return flowBasicinfoMapper.selectFlowBasicinfoById(id);
    }

    /**
     * 查询定义流程的基本信息列表
     *
     * @param flowBasicinfo 定义流程的基本信息
     * @return 定义流程的基本信息
     */
    @Override
    public List<FlowBasicinfo> selectFlowBasicinfoList(FlowBasicinfo flowBasicinfo)
    {
        return flowBasicinfoMapper.selectFlowBasicinfoList(flowBasicinfo);
    }

    /**
     * 新增定义流程的基本信息
     *
     * @param flowBasicinfo 定义流程的基本信息
     * @return 结果
     */
    @Override
    public int insertFlowBasicinfo(FlowBasicinfo flowBasicinfo)
    {
        flowBasicinfo.setCreateTime(new Date());
        flowBasicinfo.setCreateUser(SecurityUtils.getLoginUser().getUser().getNickName());
        return flowBasicinfoMapper.insertFlowBasicinfo(flowBasicinfo);
    }

    /**
     * 修改定义流程的基本信息
     *
     * @param flowBasicinfo 定义流程的基本信息
     * @return 结果
     */
    @Override
    public int updateFlowBasicinfo(FlowBasicinfo flowBasicinfo)
    {
        return flowBasicinfoMapper.updateFlowBasicinfo(flowBasicinfo);
    }

    /**
     * 批量删除定义流程的基本信息
     *
     * @param ids 需要删除的定义流程的基本信息ID
     * @return 结果
     */
    @Override
    public int deleteFlowBasicinfoByIds(Long[] ids)
    {
        return flowBasicinfoMapper.deleteFlowBasicinfoByIds(ids);
    }

    /**
     * 删除定义流程的基本信息信息
     *
     * @param id 定义流程的基本信息ID
     * @return 结果
     */
    @Override
    public int deleteFlowBasicinfoById(Long id)
    {
        return flowBasicinfoMapper.deleteFlowBasicinfoById(id);
    }
}
